﻿BEGIN TRY
	BEGIN TRAN

	MERGE [dbo].[ColumnCompareMode] AS TGT 
	USING
	(
		SELECT 1, 'Hash Attribute Match' UNION ALL
		SELECT 2, 'Direct Attribute Match'
	) AS SRC ([ColumnCompareModeId], [ColumnCompareModeName])
	ON TGT.[ColumnCompareModeId] = SRC.[ColumnCompareModeId]  

	WHEN MATCHED THEN   
	UPDATE SET
		[ColumnCompareModeName] = SRC.[ColumnCompareModeName]
	WHEN NOT MATCHED BY TARGET THEN  
		INSERT ([ColumnCompareModeId], [ColumnCompareModeName])
		VALUES (SRC.[ColumnCompareModeId], SRC.[ColumnCompareModeName])

	WHEN NOT MATCHED BY SOURCE THEN  
		DELETE;

	COMMIT TRAN;
END TRY
BEGIN CATCH
	ROLLBACK TRAN;
END CATCH
